package gui.win.runassembly;

import core.para.Para;
import gui.VTL1;
import gui.utils.Borders;
import gui.utils.FilePicker;
import gui.utils.Slider;
import gui.utils.SliderWrap;
import gui.utils.Window;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import javax.swing.JPanel;

/*Author: John Archer, Contact: john.archer.jpa@gmail.com*/
public class RunAssembly extends Window{
    private FilePicker fReads, rReads, output, lFile;
    public RunAssembly(VTL1 segL1){
        super(segL1.getLocationOnScreen().x, segL1.getLocationOnScreen().y, new Dimension(450, 360));
        JPanel p0 = new JPanel();
        p0.setBorder(Borders.getTitledBorder(Borders.STANDARD_TITLED_BORDER, "VTBUILDER SETUP"));
        p0.setLayout(new BorderLayout());
        JPanel p1 = new JPanel();
        p1.setEnabled(true);
        p1.setLayout(new GridLayout(7,1));
        p1.add(fReads = new FilePicker("Fwd. Reads",true, 24, 120, Para.PATH_TO_FOWARD_READS));
        p1.add(rReads = new FilePicker("Rev. Reads ",true, 24, 120, (Para.PATH_TO_REVERSE_READS.equals("")?Para.PATH_TO_REVERSE_READS_DEFAULT_VAL:Para.PATH_TO_REVERSE_READS)));
        p1.add(output = new FilePicker("Output",false, 24, 120, Para.PATH_TO_OUTPUT));
        p1.add(lFile = new FilePicker("Log",true, 24, 120, Para.PATH_TO_LOGFILE));
        p1.add(new SliderWrap(Slider.MNRL, 250, 120, Para.MNRL, "Min. Read Length", 240, 3));        
        p1.add(new SliderWrap(Slider.MNTLEN, 400, 150, Para.MNTLEN, "Min. Transcript Length", 240, 3));
        p1.add(new SliderWrap(Slider.CLUST_SEQ_KT_TRANS, 100, 0, Para.CLUST_SEQ_KT_TRANS, "Min. Isoform Similarity (%)", 200, 3));
        p0.add(p1, BorderLayout.NORTH);
        this.add(p0, BorderLayout.CENTER);
        this.add(new Buttons(this, segL1), BorderLayout.SOUTH);
        this.setVisible(true);
        this.setAlwaysOnTop(true);
    }

    public void closeFrame(){this.dispose();}
    public String getPathToFwdReads(){return fReads.getPath();}
    public String getPathToRevReads(){
        if(!rReads.getPath().equals("(optional)")){
            return rReads.getPath();
        }
        return "";
    }
    public String getPathToOutput(){return output.getPath();}
    public String getPathToLogFile(){return lFile.getPath();}
}
